using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
    [Table("MessageOutRelation", "", "Wicresoft.Messages.ConnectionString")]
    public class MessageOutRelation : Info
    {
        #region SQL column name consts
        public const string SQLCOL_MESSAGEID = "MessageID";
        public const string SQLCOL_OUTERPK = "OuterPK";
        public const string SQLCOL_MODULEID = "ModuleID";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public MessageOutRelation() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public MessageOutRelation(string OuterPK, Guid ModuleID)
        {
            this.OuterPK = OuterPK;
            this.ModuleID = ModuleID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            MessageID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_MESSAGEID]);
            OuterPK = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_OUTERPK]);
            ModuleID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_MODULEID]);
        }

        #region Properties
        #region Property <Guid> MessageID
        [Property("MessageID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid MessageID
        {
            get { return _MessageID; }
            set { _MessageID = value; }
        }
        private Guid _MessageID = Guid.Empty;
        #endregion

        #region Property <string> OuterPK
        [Property("OuterPK", 200, SqlDbType.NVarChar, false, true)]
        public string OuterPK
        {
            get { return _OuterPK; }
            set { _OuterPK = value; }
        }
        private string _OuterPK = null;
        #endregion

        #region Property <Guid> ModuleID
        [Property("ModuleID", 16, SqlDbType.UniqueIdentifier, false, true)]
        public Guid ModuleID
        {
            get { return _ModuleID; }
            set { _ModuleID = value; }
        }
        private Guid _ModuleID = Guid.Empty;
        #endregion
        #endregion




    }
}
